<template>
  <div class="login">
    <div class="login_form">
      <div class="login_form_title">欢迎登录</div>
      <div class="login_form_input">
        <el-form
          :model="form"
          label-width="70px"
          label-position="right"
          size="large"
        >
          <el-form-item label="用户名：">
            <el-input v-model="state.form.userName" />
          </el-form-item>
          <el-form-item label="密码：">
            <el-input v-model="state.form.userPassword" />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="loginSubmitList">登录</el-button>
            <el-button type="primary" @click="onSubmit">注册</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
import { onMounted, reactive, ref } from "vue";
import { loginSubmit } from "@/api/login/index.js";

export default {
  setup() {
    const state = reactive({
      data: [],
      form: { userName: "22", userPwd: "222", id: "12312", isAdmin: "1" },
    });
    onMounted(() => {
      // getList();
    });
    const loginSubmitList = () => {
      loginSubmit(state.form).then((res) => {
        console.log(res);
      });
    };

    return {
      state,
      loginSubmitList,
    };
  },
};
</script>
<style lang="scss" scoped>
.login {
  width: 100%;
  height: 100%;
  background: url("../../assets/img/login.png") no-repeat;
  background-size: 100% 100%;
  position: relative;
  .login_form {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    right: 0;
    width: 400px;
    height: 600px;
    background: #fff;
    margin: 200px auto;
    border-radius: 12px;
    overflow: hidden;
    padding: 24px;
    border: 2px solid #ccc;
    box-sizing: border-box;
    opacity: 1;
    .login_form_title {
      height: 60px;
      line-height: 60px;
      font-size: 48px;
      text-align: center;
      margin-top: 80px;
      color: #000;
      opacity: 1;
    }
    .login_form_input {
      width: 100%;
      height: calc(100% - 140px);
      padding: 100px 40px 100px 0;
      box-sizing: border-box;
      ::v-deep .el-form-item__content {
        justify-content: space-between;
      }
    }
  }
}
</style>
